function loadingViewData(e, t, a, o, n) {
    viewModalAjax = $.ajax({
        type: "POST",
        url: t,
        data: a,
        dataType: "json",
        timeout: 3e4,
        success: function(t) {
            $(e).boxBsLoadingReset(), o(t)
        },
        error: function() {
            $(e).boxBsLoadingReset(), messageAlert.bsError("加载失败，请重试"), n()
        }
    })
}

function initHistory() {
    var e = document.getElementById("historyTitle") && $("#historyTitle").text(),
        t = {
            url: window.location.href,
            title: e,
            id: $("#historyTitle").attr("data-id"),
            type: $("#historyTitle").attr("data-type")
        },
        a = window.localStorage.getItem("kejianBrowseHistory") ? JSON.parse(window.localStorage.getItem("kejianBrowseHistory")) : [],
        o = !0;
    if (a && a.length > 0) {
        $(".history-lists").attr("data-empty", "false");
        var n = "";
        $(a).each(function(e, a) {
            a.url === t.url && (o = !1), 10 > e && (n += '<li><a class="text-ellipsis text-dark" target="_self" href="' + a.url + '">' + a.title + "</a></li>")
        }), $(".history-lists").html(n)
    } else $(".history-lists").addClass("no-history");
    o && e && (a.unshift(t), a.length > 10 && a.pop(), window.localStorage.setItem("kejianBrowseHistory", JSON.stringify(a)))
}

function loginCookie(e) {
    var t = e.data.avatar ? e.data.avatar : "/static/images/head_portrait.png",
        a = e.data.nick_name ? e.data.nick_name : "用户名";
    $.cookie("yuanwenku-login-status", "1", {
        expires: 1,
        path: "/"
    }), $.cookie("yuanwenku-login-avatar", t, {
        expires: 1,
        path: "/"
    }), $.cookie("yuanwenku-login-username", a, {
        expires: 1,
        path: "/"
    }), $.cookie("yuanwenku-login-uid", e.data.uid, {
        expires: 1,
        path: "/"
    }), $.cookie("yuanwenku-login-vip", e.data.is_vip, {
        expires: 1,
        path: "/"
    }), $(".user-avatar").prop("src", t), $(".user-name").text(a)
}

function createColumnLIst(e, t) {
    $(e).each(function(e, a) {
        var o = "";
        o = 50 === a.code_level ? '<a role="button" class="btn btn-outline-danger flex-shrink-0 mr-2">专供</a>\n' : 49 === a.code_level ? '<a role="button" class="btn btn-outline-warning flex-shrink-0 mr-2">精品</a>\n' : "";
        var n = "";
        a.name_year || a.name_type || a.name_stage || a.name_subject || a.name_grade ? (n = '<div class="font-14 sign mt-3">\n', a.name_year && (n = n + '<a class="btn btn-light mr-2 disabled opacity-1">' + a.name_year + "</a>\n"), a.name_type && (n = n + '<a class="btn btn-light mr-2 disabled opacity-1">' + a.name_type + "</a>\n"), (a.name_stage || a.name_subject) && (n = n + '<a class="btn btn-light mr-2 disabled opacity-1">' + a.name_stage + a.name_subject + "</a>\n"), a.name_grade && (n = n + '<a class="btn btn-light mr-2 disabled opacity-1">' + a.name_grade + "</a>\n"), n += "</div>\n") : n = "";
        var i = a.is_membership && 1 === a.is_membership ? "true" : "false",
            s = a.highlight && a.highlight["doc.title"] && a.highlight["doc.title"][0] ? a.highlight["doc.title"][0] : a.title,
            r = a.file_size,
            d = "",
            l = '<p class="mr-4 pr-3 mb-0">页数：' + a.file_pages + "页</p>\n";
        "rar" !== a.file_ext && "zip" !== a.file_ext && "7z" !== a.file_ext ? d = '<a class="text-black-50 font-14 view-modal mb-3 d-block"\ndata-price="' + a.price + '"\n' + 'data-size="' + r + 'KB"\n' + 'data-page="' + a.file_pages + '"\n' + 'data-type="' + a.file_ext + '"\n' + 'data-vip="' + i + '"\n' + 'data-cid=""\n' + 'data-id="' + a.id + '"\n' + 'data-collection=""\n' + 'data-title="' + a.title + '"\n' + 'data-href="' + a.url_pc + '">快速预览</a>\n' : l = '<p class="mr-4 pr-3 mb-0">文件数：' + (a.file_number ? a.file_number : "0") + "个</p>\n";
        var c = '<li class="d-flex border-bottom">\n                                <div class="flex-shrink-0 mr-3 items-img">\n                                    <div class="img-box office-pic office-pic-' + a.file_ext + '">\n' + "                                    </div>\n" + "                                </div>\n" + '                                <div class="flex-grow-1">\n' + '                                    <div class="d-flex align-items-center">\n' + o + "\n" + '                                        <a class="text-dark flex-grow-1 title" target="_blank" title="' + a.title + '" href="' + a.url_pc + '">\n' + '                                            <h5 class="text-ellipsis font-weight-bold">\n' + "                                                " + s + "</h5>\n" + "                                        </a>\n" + "                                    </div>\n" + n + '                                    <div class="d-flex font-14 text-secondary mt-3 items-info">\n' + '                                        <p class="mr-4 pr-3 mb-0">ID：' + a.content_code + "</p>\n" + '                                        <p class="mr-4 pr-3 mb-0">大小：' + r + "</p>\n" + l + '                                        <p class="mr-4 pr-3 mb-0">更新时间：' + a.update_at.slice(0, 10) + "</p>\n" + "                                    </div>\n" + "                                </div>\n" + '                                <div class="flex-shrink-0 ml-4 text-center d-flex align-items-center">\n' + "                                    <div>\n" + d + '                                        <a href="' + a.url_pc + '" class="btn btn-primary d-block font-14"\n' + "                                        >查看全文</a>\n" + "                                    </div>\n" + "                                </div>\n" + "                            </li>";
        $(t).append(c)
    })
}

function createTopicLIst(e, t) {
    $(e).each(function(e, a) {
        var o = "1" === a.recommend || 1 === a.recommend ? '<a class="btn btn-danger flex-shrink-0">推</a>' : "",
            n = a.category ? a.category.name : "",
            i = '<li class="d-flex border-bottom">\n                                <div class="flex-shrink-0 mr-3 items-img">\n                                    <div class="img-box position-relative">\n                                        <p class="img-txt text-ellipsis-3">' + a.name + "</p>\n" + '                                        <img src="/static/images/book-default.png">\n' + "                                    </div>\n" + "                                </div>\n" + '                                <div class="flex-grow-1">\n' + '                                    <div class="d-flex align-items-center">\n' + o + '                                                                                <a class="text-dark flex-grow-1 title stretched-link" href="' + a.url + '">\n' + '                                            <h5 class="text-ellipsis font-weight-bold">' + a.name + "</h5>\n" + "                                        </a>\n" + "                                    </div>\n" + '                                    <p class="text-secondary font-14 mt-3 text-ellipsis-2">\n' + '                                        <span class="text-dark">简介：</span>' + a.introduction + "</p>\n" + '                                    <div class="d-flex font-14 text-secondary items-info">\n' + '                                        <p class="mr-4 pr-3 mb-0">时间：' + a.update_at.slice(0, 10) + "</p>\n" + '                                        <p class="mr-4 pr-3 mb-0">类型：' + n + "</p>\n" + "\n" + "                                    </div>\n" + "                                </div>\n" + "                            </li>";
        $(t).append(i)
    })
}

function testSpicel(e) {
    var t = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~！@#￥%……&*（）——\-+={}|《》？：“”【】、；‘'，。、]/im;
    return t.test(e) ? !0 : !1
}

function search(e, t, a) {
    $(t).attr("data-target");
    var o = $(t).html();
    if (e) {
        if (e.length > 50) return messageAlert.bsError("搜索词不能大于50个字符"), void 0;
        if (testSpicel(e)) return messageAlert.bsError("搜索词中不能包含特殊字符"), void 0;
        if ($(t).btnLoading("", "", !0), a && "result" === a) {
            var n = window.location.href; - 1 === n.indexOf("?") ? (window.location.href = n + "?key_words=" + e, $(t).btnReset(o)) : (window.location.href = n + "&key_words=" + e, $(t).btnReset(o))
        } else window.location.href = "/search?key_words=" + e, $(t).btnReset(o)
    }
}

function searchBtn() {
    $('[data-btn="search"]').each(function(e, t) {
        var a = $(t).attr("data-target"),
            o = $(t).attr("data-type") || "";
        $("#" + a).bind("keyup", function(e) {
            var a = $.trim($(this).val());
            ("13" === e.keyCode || 13 === e.keyCode) && search(a, t, o)
        })
    }), $('[data-btn="search"]').click(function() {
        var e = $(this).attr("data-target"),
            t = $(this).attr("data-type") || "",
            a = $.trim($("#" + e).val());
        search(a, this, t)
    })
}

function createQrcode(e, t, a) {
    $("#" + t).html("");
    var o = a || 120;
    new QRCode(t, {
        text: e,
        width: o,
        height: o,
        colorDark: "#000000",
        colorLight: "#ffffff",
        correctLevel: QRCode.CorrectLevel.H,
        render: "canvas"
    })
}

function createAliQrcode(e, t, a) {
    var o = a || 120;
    $("#" + t).html('<iframe id="aliQrcodeIframe" name="aliQrcodeIframe" scrolling="no" border="0" height=' + o + " width=" + o + " frameborder=0 ></iframe>"), aliQrcodeIframe.window.document.write(e)
}

function getAccessToken() {
    $.ajax({
        type: "POST",
        url: "/upload_api/get_common_token",
        data: {},
        dataType: "json",
        timeout: 3e4,
        success: function(e) {
            200 === e.code && (accessToken = e.data.access_token, $("#feedbackImage").fileinput("refresh", {
                ajaxSettings: {
                    headers: {
                        Authorization: accessToken
                    }
                }
            }))
        },
        error: function() {}
    })
}

function fixedNavAndTop() {
    var e = $("body").hasClass("noScrollFixed");
    $("body").hasClass("noScrollTop"), $("body").hasClass("noScrollTree");
    var t = 0,
        a = 0,
        o = 0;
    document.getElementById("columnDetailSiderRight") && (a = $("footer").offset().top, t = $("#columnDetailSiderRight").outerHeight(!0) + 70, o = -$("#columnDetailSiderRight").outerHeight(!0) - 213 + $(window).outerHeight(!0)), this.showEwm = function(e, t) {
        $(e).hover(function() {
            $(t).show()
        }, function() {
            $(t).hide()
        })
    }, this.goTop = function() {
        $(window).scrollTop() > 100 ? ($("#goToTop").show(), $("#coloumnDetailNav").show(), e || ($("#scrollFixed").addClass("fixedNav"), $("#scrollFixed").addClass("opacity-1")), $("#treeSidebar").addClass("fixedSidebar"), $("#treeSidebar").addClass("opacity-1")) : ($("#goToTop").hide(), $("#coloumnDetailNav").hide(), e || ($("#scrollFixed").removeClass("fixedNav"), $("#scrollFixed").removeClass("opacity-1")), $("#treeSidebar").removeClass("fixedSidebar"), $("#treeSidebar").removeClass("opacity-1")), $(window).scrollTop() > 254 ? document.getElementById("columnDetailSiderRight") && $(window).scrollTop() + t > a ? ($("#columnDetailSiderRight").addClass("columnFixedSidebar2"), $("#columnDetailSiderRight").css("margin-top", o + "px")) : ($("#columnDetailSiderRight").removeClass("columnFixedSidebar2"), $("#columnDetailSiderRight").addClass("columnFixedSidebar"), $("#columnDetailSiderRight").css("margin-top", 0)) : ($("#columnDetailSiderRight").removeClass("columnFixedSidebar"), $("#columnDetailSiderRight").removeClass("columnFixedSidebar2")), $(window).scroll(function() {
            $(window).scrollTop() > 100 ? (e || ($("#scrollFixed").addClass("fixedNav"), $("#scrollFixed").addClass("opacity-1")), $("#treeSidebar").addClass("fixedSidebar"), $("#treeSidebar").addClass("opacity-1"), $("#goToTop").fadeIn(200), $("#coloumnDetailNav").fadeIn(200)) : ($("#goToTop").fadeOut(200), $("#coloumnDetailNav").fadeOut(200), e || ($("#scrollFixed").removeClass("fixedNav"), $("#scrollFixed").removeClass("opacity-1")), $("#treeSidebar").removeClass("fixedSidebar"), $("#treeSidebar").removeClass("opacity-1")), $(window).scrollTop() > 254 ? document.getElementById("columnDetailSiderRight") && $(window).scrollTop() + t > $("footer").offset().top ? ($("#columnDetailSiderRight").addClass("columnFixedSidebar2"), $("#columnDetailSiderRight").css("margin-top", o + "px")) : ($("#columnDetailSiderRight").css("margin-top", 0), $("#columnDetailSiderRight").removeClass("columnFixedSidebar2"), $("#columnDetailSiderRight").addClass("columnFixedSidebar")) : ($("#columnDetailSiderRight").removeClass("columnFixedSidebar"), $("#columnDetailSiderRight").removeClass("columnFixedSidebar2"))
        }), $("body").on("click", "#goToTop", function() {
            return $("body,html").animate({
                scrollTop: 0
            }, 500), !1
        })
    }, this.showFixedNav = function() {
        $(window).scrollTop() > 100 ? ($("#scrollFixed").addClass("fixedNav"), $("#scrollFixed").addClass("opacity-1")) : ($("#scrollFixed").removeClass("fixedNav"), $("#scrollFixed").removeClass("opacity-1")), $(window).scroll(function() {
            $(window).scrollTop() > 100 ? ($("#scrollFixed").addClass("fixedNav"), $("#scrollFixed").addClass("opacity-1")) : ($("#scrollFixed").removeClass("fixedNav"), $("#scrollFixed").removeClass("opacity-1"))
        })
    }
}

function createNewObject(e) {
    var t = function() {};
    return t.prototype = e, new t
}

function initCollapseMore(e) {
    $("body").off("click", ".collapse-more"), $("body").on("click", ".collapse-more", function() {
        var e = $(this).find("span").eq(0).text();
        $(this).find("i").toggleClass("rotate-180"), "展开" === e ? $(this).find("span").text("收起") : $(this).find("span").text("展开"), $(this).parent().find(".collapse-items").toggleClass("collapse-more-list")
    }), $(e).each(function(e, t) {
        $(t).parent().find(".collapse-more").hide();
        var a = $(t).outerWidth(),
            o = 0,
            n = $(t).find(".active-c"),
            i = $(t).find(">.more-item").length;
        $(t).find(">.more-item").each(function(e, t) {
            o += $(t).outerWidth(!0), a > o && (a > o + 77 ? $(t).attr("data-moreshow", "true") : e + 1 === i && $(t).attr("data-moreshow", "true"))
        }), o > a && ($(t).parent().find(".collapse-more").show(), n.is(":hidden") && ($(t).parent().find(".collapse-more span").text("收起"), $(t).parent().find(".collapse-more i").addClass("rotate-180"), $(t).removeClass("collapse-more-list")))
    })
}

function checkAll(e, t) {
    var a = $(e).attr("data-toggle");
    $(e).on("change", function() {
        $(this).prop("checked") ? $(a).prop("checked", !0) : $(a).prop("checked", !1), t && t(a)
    }), $("body").on("change", a, function() {
        $(this).prop("checked") ? ($(e).prop("checked", !0), $(a).each(function(t, a) {
            return $(a).prop("checked") ? void 0 : ($(e).prop("checked", !1), !1)
        })) : $(e).prop("checked", !1), t && t(a)
    })
}

function initPage(e, t) {
    var a = "";
    if (e > 1)
        if (1 === t) {
            for (var o = e > 9 ? 9 : e, a = '<button class="btn btn-light disabled" tabindex="-1" role="button" aria-disabled="true" data-page="1" disabled>首页</button>\n<button class="btn btn-light disabled" tabindex="-1" role="button" aria-disabled="true" data-page="2" disabled>上一页</button>\n <button class="btn btn-primary" tabindex="-1" role="button" aria-disabled="true" data-page="1">1</button>\n', n = 2; o >= n; n++) a = a + ' <button class="btn btn-light"  data-page="' + n + '">' + n + "</button>\n";
            a = a + '<button class="btn btn-light" data-page="2">下一页</button>\n' + '<button class="btn btn-light" data-page="' + e + '">末页</button>\n'
        } else if (t === e) {
            for (var o = e > 9 ? e - 8 : 1, a = '<button class="btn btn-light" role="button" data-page="1">首页</button>\n<button class="btn btn-light" role="button" data-page="' + (e - 1) + '">上一页</button>\n', n = o; e - 1 >= n; n++) a = a + ' <button class="btn btn-light"  data-page="' + n + '">' + n + "</button>\n";
            a = a + ' <button class="btn btn-primary" tabindex="-1" role="button" aria-disabled="true">' + e + "</button>\n" + '<button class="btn btn-light disabled" tabindex="-1" role="button" aria-disabled="true" disabled>下一页</button>\n' + '<button class="btn btn-light disabled" tabindex="-1" role="button" aria-disabled="true" disabled>末页</button>\n'
        } else {
            var i = 1,
                s = 1,
                r = t + 1,
                d = t - 1;
            5 > t ? (i = 1, s = e > 8 ? 9 : e) : t > 4 && (i = t - 4, e - t > 3 ? s = t + 4 : (s = e, i = t - (8 - (e - t)) > 0 ? t - (8 - (e - t)) : 1));
            for (var a = '<button class="btn btn-light" data-page="1">首页</button>\n<button class="btn btn-light" data-page="' + d + '">上一页</button>\n', n = i; s >= n; n++) a = n === t ? a + '<button class="btn btn-primary" tabindex="-1" role="button" aria-disabled="true" data-page="' + n + '">' + n + "</button>\n" : a + '<button class="btn btn-light"  data-page="' + n + '">' + n + "</button>\n";
            a = a + '<button class="btn btn-light"  data-page="' + r + '">下一页</button>\n' + '<button class="btn btn-light" data-page="' + e + '">末页</button>\n'
        }
    $(".page-list").html(a), $(".page-list").attr("data-total", e)
}

function getBlock(e, t, a, o, n) {
    $.ajax({
        type: "POST",
        url: o,
        data: {
            block_code: e
        },
        dataType: "json",
        timeout: 3e4,
        success: function(e) {
            if ("footer" === a) {
                var o = document.createDocumentFragment();
                $(e.data).each(function(e, t) {
                    var a = document.createElement("li"),
                        n = "<h5>" + t.name + "</h5>";
                    $(t.list).each(function(e, t) {
                        n = n + '<a href="' + t.url + '">' + t.name + "</a>"
                    }), a.innerHTML = n, o.appendChild(a)
                }), $(t).append(o)
            } else "img" === a ? $(t).prop("src", e.data[0].thumb) : "txt" === a ? $(t).html(e.data) : "custom" === a ? n(e) : "bg" === a && $(t).css({
                "background-image": "url(" + e.data[0].thumb + ")"
            })
        },
        error: function() {}
    })
}

function initPopdownPosition(e, t) {
    var a = $(window).width();
    $(e).each(function(e, o) {
        return $(o).hasClass("dropdown-menu-right") || $(o).hasClass("dropdown-menu-left") ? !1 : ($(o).offset().left + t > a ? $(o).siblings(".dropdown-menu").addClass("dropdown-menu-right") : $(o).siblings(".dropdown-menu").addClass("dropdown-menu-left"), void 0)
    })
}

function checkAllCategory(e, t, a) {
    var o = $(t).attr("data-toggle");
    $("body").on("change", t, function() {
        $(this).prop("checked") ? ($(o).prop("checked", !0), $(e).prop("checked", !0)) : ($(o).prop("checked", !1), $(e).prop("checked", !1)), a && a(o)
    }), $("body").on("change", e, function() {
        var t = $(this).attr("data-toggle"),
            n = $($(this).parents("li")[0]).find(t),
            i = $($(this).parents("li")[0]).find(e);
        $(this).prop("checked") ? ($(n).prop("checked", !0), $(i).prop("checked", !0), $(this).parents(".topic-content-catalog-item").each(function(t, a) {
            if (0 !== t) {
                var o = $(a).find("input[type=checkbox]");
                o && o.length && ($(a).find(e).eq(0).prop("checked", !0), $(o).each(function(t, o) {
                    return $(o).prop("checked") ? void 0 : ($(a).find(e).eq(0).prop("checked", !1), !1)
                }))
            }
        })) : ($(n).prop("checked", !1), $(i).prop("checked", !1), $(this).parents(".topic-content-catalog-item").each(function(t, a) {
            $(a).find(e).eq(0).prop("checked", !1)
        })), a && a(o)
    }), $("body").on("change", o, function() {
        $(this).parents(".lastCollapsable").find(e).each(function(e, t) {
            var a = $(this).attr("data-toggle"),
                o = $($(this).parents("li")[0]).find(a);
            o && o.length && ($(t).prop("checked", !0), $(o).each(function(e, a) {
                return $(a).prop("checked") ? void 0 : ($(t).prop("checked", !1), !1)
            }))
        }), a && a(o)
    })
}

function ajaxLinkTo(e, t, a) {
    $.ajax({
        type: "POST",
        url: "/member_login/check_login",
        data: {},
        dataType: "json",
        timeout: 3e4,
        success: function(o) {
            200 === o.code ? a ? openWin(e, a) : location.href = e : (messageAlert.bsWarning("请先登录"), a ? openWin(t, a) : location.href = t)
        },
        error: function() {
            messageAlert.bsWarning("网络错误，请稍后重试")
        }
    })
}

function needLoginTo(e, t) {
    var a = $(this).attr("data-target");
    $.cookie("yuanwenku-login-status") && "1" === $.cookie("yuanwenku-login-status") ? "blank" === a ? window.open(e) : window.location.href = e : "blank" === a ? window.open(t) : window.location.href = t
}

function openWin(e, t) {
    try {
        t.location.href = e, t.focus()
    } catch (a) {
        window.open(e)
    }
}


function getServiceCenterBlock() {
    getBlock("service_center", "#serviceCenter", "custom", "/content_block/get_public_block_by_code", function(e) {
        var t = document.createDocumentFragment();
        $(e.data).each(function(e, a) {
            var o = document.createElement("a");
            o.className = "dropdown-item", o.innerText = a.title, o.href = a.title_url, t.appendChild(o)
        }), $("#serviceCenter").append(t)
    })
}

function getSiteNavBlock() {
    getBlock("site_nav", "#siteNav", "custom", "/content_block/get_public_block_by_code", function(e) {
        var t = document.createDocumentFragment();
        $(e.data).each(function(e, a) {
            var o = document.createElement("a");
            o.className = "text-secondary col-4 mb-2", o.innerText = a.title, o.href = a.title_url, t.appendChild(o)
        }), $("#siteNav").append(t)
    })
}

function getCommonHeaderNAVBlock() {
    getBlock("common_header_nav", "#commonHeaderNav", "custom", "/content_block/get_public_block_by_code", function(e) {
        var t = document.createDocumentFragment(),
            a = document.createElement("li");
        a.className = "nav-item dropdown", a.innerHTML = '<a class="nav-link dropdown-toggle dropdown-more py-3" data-toggle="dropdown" data-hover="dropdown"\n            href="#" role="button"\n            aria-haspopup="true" aria-expanded="false">\n                <i class="iconfont">&#xe60d;</i>\n            </a>';
        var o = document.createElement("div"),
            n = "";
        o.className = "dropdown-menu", $(e.data).each(function(e, a) {
            if (8 > e) {
                var o = document.createElement("li");
                o.className = "nav-itme";
                var i = '<a class="nav-link py-3" href="' + a.title_url + '">' + a.title + "</a>";
                o.innerHTML = i, t.appendChild(o)
            } else {
                var i = '<a class="nav-link py-3" href="' + a.title_url + '">' + a.title + "</a>";
                n += i
            }
        }), o.innerHTML = n, a.appendChild(o), $("#commonHeaderNav").append(t), e.data.length > 8 && $("#commonHeaderNav").append(a)
    })
}

function insertUserInfo(e) {
    $.ajax({
        type: "POST",
        url: "/user/get_user_info",
        data: {},
        dataType: "json",
        timeout: 3e4,
        success: function(t) {
            200 === t.code && $(e).each(function(e, a) {
                $(a.dom).text(t.data[a.key])
            })
        },
        error: function() {}
    })
}

function calcTextarea(e, t) {
    var a = document.createElement("div");
    a.className = "custom-textarea-calc", a.innerText = "0 / " + t, $(e).append(a);
    var o = $(e).find("textarea").eq(0);
    o.on("keyup", function() {
        var e = o.val();
        e.length > t ? (e = e.substring(0, t), o.val(e), a.innerText = t + " / " + t) : a.innerText = e.length + " / " + t
    })
}

function downloadFiles(e) {
    var t = "/" + e.old + "/download";
    e.isVip && "true" === e.isVip && (t = "/" + e.old + "/member_download"), $("#errorRec,#successRec").html(""), $("#errorRec,#successRec").attr({
        "data-loading": "true",
        "data-empty": "false"
    }), $.ajax({
        type: "POST",
        url: "/" + e.old + "/get_concerned_doc",
        data: {
            id: e.id
        },
        dataType: "json",
        timeout: 3e4,
        success: function(e) {
            200 === e.code ? e.data.length > 0 ? ($(e.data).each(function(e, t) {
                if (e > 3) return !1;
                var a = '<li class="col-6 mt-0">\n  <a class="text-ellipsis office-icon text-dark py-1 office-icon-' + t.file_ext + '"\n' + '                               href="' + t.url_pc + '">' + t.title + "</a>\n" + "</li>";
                $("#errorRec,#successRec").append(a)
            }), $("#errorRec,#successRec").attr({
                "data-loading": "false",
                "data-empty": "false"
            })) : $("#errorRec,#successRec").attr({
                "data-loading": "false",
                "data-empty": "true"
            }) : (messageAlert.bsError(e.msg), $("#errorRec,#successRec").attr({
                "data-loading": "false",
                "data-empty": "true"
            }))
        },
        error: function() {
            messageAlert.bsError("网络错误，请稍后重试")
        }
    }), $.ajax({
        type: "POST",
        url: t,
        data: {
            content_ids: e.id,
            pay_type: e.payType,
            order_type: "",
            order_no: e.orderNo
        },
        dataType: "json",
        timeout: 3e4,
        success: function(t) {
            200 === t.code ? (clearInterval(noMoreBalanceInterval), window.location.href = t.data.url[0], $(".sendEmail").attr("data-download", t.data.url[0]), $("#hasBalance").modal("hide"), $("#noMoreBalance").modal("hide"), $("#noVipBalance").modal("hide"), $("#downloadError").modal("hide"), $("#downloadSuccess").modal("show"), messageAlert.bsSuccess(t.msg)) : 0 === t.code ? messageAlert.bsError(t.msg) : ($("#hasBalance").modal("hide"), $("#noMoreBalance").modal("hide"), $("#noVipBalance").modal("hide"), $("#downloadError").modal("show"), $("#downloadSuccess").modal("hide"), messageAlert.bsError(t.msg)), e.btn && e.btn.btnReset(e.btnHtml ? e.btnHtml : !1)
        },
        error: function() {
            messageAlert.bsError("网络错误，请稍后重试"), e.btn && e.btn.btnReset(e.btnHtml ? e.btnHtml : !1)
        }
    })
}
var host = window.location.host;
$.fn.extend({
    btnLoading: function(e, t, a, o) {
        var t = t || "spinner-border-sm",
            n = o;
        $(this).attr("disabled", !0);
        var i = '<span class="spinner-border ' + t + '" role="status" aria-hidden="true"></span>';
        e ? $(this).html(i + e) : a ? $(this).html(i) : n ? $(this).html(i + $(this).html()) : $(this).prepend(i)
    },
    btnReset: function(e) {
        $(this).attr("disabled", !1), e && $(this).html(e), $(this).find(".spinner-border").remove()
    },
    iconLoading: function() {
        $(this).addClass("disabled"), $(this).attr("aria-disabled", "true"), $(this).attr("disabled", !0), $(this).find("i").html("&#xe771;").addClass("loading-icon")
    },
    iconReset: function(e) {
        $(this).attr("disabled", !1), $(this).removeClass("disabled"), $(this).attr("aria-disabled", "false"), e && $(this).html(e)
    },
    btnLoading2: function(e) {
        $(this).attr("disabled", !0), $(this).addClass("btn-loading"), e && $(this).text(e)
    },
    btnReset2: function(e) {
        $(this).attr("disabled", !1), e && $(this).text(e), $(this).removeClass("btn-loading")
    },
    boxLoading: function(e) {
        var t = document.createElement("div");
        t.className = "box-loading", e && (t.innerHTML = "<P>" + e + "</P>"), $(this).append(t)
    },
    bodyLoading: function(e) {
        $(".body-loading").remove();
        var t = document.createElement("div");
        t.className = "body-loading", e && (t.innerHTML = "<P>" + e + "</P>"), $(this).append(t)
    },
    bodyReset: function() {
        $(".body-loading").remove()
    },
    boxBsLoading: function() {
        var e = '<div class="spinner-border text-primary spinner-border-center" role="status">\n                    <span class="sr-only">Loading...</span>\n                </div>';
        $(this).append(e)
    },
    boxBsLoadingReset: function() {
        $(this).find(".spinner-border").remove()
    },

    loadingData: function(e) {
        var t = e || "数据加载中，请稍候...";
        $(this).html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>\n' + t)
    },
    completeData: function(e) {
        $(this).html(e || "没有更多数据了")
    }
});
var wxLoginStatusInterval, wxSceneStr, isOpenModalFirst = !0,
    loginWechat = function(e) {
        $("#loginWechat img").prop("src", e);
    },
viewModalAjax, requestWxUrl = function() {
    $("#loginWechat").attr("data-needqrcode", "false"), $("#loginWechat").attr("data-loading", "true"), $.ajax({
        type: "POST",
        url: "/member_login/get_wechat_qrcode",
        data: {},
        dataType: "json",
        timeout: 3e4,
        success: function(e) {
            200 === e.code ? (wxSceneStr = e.data.scene_str, loginWechat(e.data.url), $("#loginWechat").attr("data-needqrcode", "false"), clearInterval(wxLoginStatusInterval), wxLoginStatusInterval = setInterval(function() {
                requestLoginStatus(e.data.scene_str)
            }, 3e3)) : ($("#loginWechat").attr("data-needqrcode", "true"), $("#loginWechat").attr("data-loading", "false"), messageAlert.bsError(e.msg))
        },
        error: function() {
            $("#loginWechat").attr("data-needqrcode", "true"), $("#loginWechat").attr("data-loading", "false")
        }
    })
};


var refreshPicVericode = function(e) {
        // $(e).parent().btnLoading2(), $.ajax({
        //     type: "POST",
        //     url: "/member_login/get_captcha",
        //     data: {},
        //     dataType: "json",
        //     timeout: 3e4,
        //     success: function(t) {
        //         $(e).prop("src", t.data.image), $(e).attr("data-cid", t.data.real_code), $(e).attr("data-key", t.data.key), $(".hiddenKey").val(t.data.key), $(e).parent().btnReset2()
        //     },
        //     error: function() {}
        // })
    },
    requestLoginStatus = function(e) {
        $.ajax({
            type: "POST",
            url: "/member_login/check_login",
            data: {
                scene_str: e
            },
            dataType: "json",
            timeout: 3e4,
            success: function(e) {
                200 === e.code && (clearInterval(wxLoginStatusInterval), $("#closeLoginModal").click(), loginCookie(e), loginHideShow.login(), messageAlert.bsSuccess("登录成功"))
            },
            error: function() {}
        })
    },
    loginOut = function(e) {

    },
    collectionArticle = function(e, t, a) {
        var o = $(e).attr("data-bindcol"),
            n = $(e).html();
        o && "true" === o ? $('[data-bindcol="true"]').iconLoading() : $(e).iconLoading(), $.ajax({
            type: "POST",
            url: a,
            data: t,
            dataType: "json",
            timeout: 3e4,
            success: function(a) {
                o && "true" === o ? $('[data-bindcol="true"]').iconReset(n) : $(e).iconReset(n), 200 === a.code ? 0 === t.status ? (o && "true" === o ? $('[data-bindcol="true"]').attr("data-collection", "false") : $(e).attr("data-collection", "false"), $(".view-modal").each(function(e, a) {
                    $(a).attr("data-id") === t.id && $(a).attr("data-collection", "false")
                })) : (o && "true" === o ? $('[data-bindcol="true"]').attr("data-collection", "true") : $(e).attr("data-collection", "true"), $(".view-modal").each(function(e, a) {
                    $(a).attr("data-id") === t.id && $(a).attr("data-collection", "true")
                })) : messageAlert.bsError(a.msg)
            },
            error: function() {
                messageAlert.bsError("请求失败，请稍后重试或者联系客服"), o && "true" === o ? $('[data-bindcol="true"]').iconReset(n) : $(e).iconReset(n)
            }
        })
    },
    scrollLoadingAnimation = function() {
        var e = $(window).scrollTop(),
            t = $(window).outerHeight(!0),
            a = 200;
        $(".animation-t,.animation-b,.animation-l,.animation-r").each(function(o, n) {
            var i = $(n).offset().top,
                s = parseInt($(n).attr("data-delay"));
            i > e && e + t > i && (s && s > 0 ? setTimeout(function() {
                $(n).removeClass("animation-t animation-b animation-l animation-r")
            }, s * a) : $(n).removeClass("animation-t animation-b animation-l animation-r"))
        }), $(window).scroll(function() {
            $(".animation-t,.animation-b,.animation-l,.animation-r").each(function(e, o) {
                var n = $(o).offset().top,
                    i = parseInt($(o).attr("data-delay"));
                n > $(window).scrollTop() && n < $(window).scrollTop() + t && (i && i > 0 ? setTimeout(function() {
                    $(o).removeClass("animation-t animation-b animation-l animation-r")
                }, i * a) : $(o).removeClass("animation-t animation-b animation-l animation-r"))
            })
        })
    },
    messageAlert = {
        successIcon: "fa fa-check-circle-o",
        errorIcon: "fa fa-times-circle-o",
        timeOut: 3e3,
        success: function(e) {
            var t = document.createElement("div");
            t.className = "success-message message-alert";
            var a = document.createElement("i");
            a.className = this.successIcon;
            var o = document.createElement("span");
            o.innerText = e, t.appendChild(a), t.appendChild(o), $("#messageAlert").append(t), $(t).animate({
                opacity: 1
            }, 100), setTimeout(function() {
                $(t).remove()
            }, this.timeOut)
        },
        error: function(e) {
            var t = document.createElement("div");
            t.className = "error-message message-alert";
            var a = document.createElement("i");
            a.className = this.errorIcon;
            var o = document.createElement("span");
            o.innerText = e, t.appendChild(a), t.appendChild(o), $("#messageAlert").append(t), $(t).animate({
                opacity: 1
            }, 100), setTimeout(function() {
                $(t).remove()
            }, this.timeOut)
        },
        bsSuccess: function(e, t) {
            var a = t || "成功",
                o = document.createElement("div");
            o.setAttribute("role", "alert"), o.setAttribute("aria-live", "assertive"), o.setAttribute("aria-atomic", "true");
            var n = "toast" + (new Date).getTime();
            o.className = "toast toast-success toast-custom " + n;
            var i = '        <div class="toast-header bg-success text-white">\n            <strong class="mr-auto">' + a + "</strong>\n" + "            <small></small>\n" + '            <button type="button" class="ml-2 mb-1 close text-white" data-dismiss="toast" aria-label="Close">\n' + '                <span aria-hidden="true">&times;</span>\n' + "            </button>\n" + "        </div>\n" + '        <div class="toast-body toast-custom-success"><i class="iconfont">&#xe604;</i>' + e + "</div>\n";
            o.innerHTML = i, $(".toast-area").append(o), $(o).toast({
                delay: this.timeOut
            }).toast("show")
        },
        bsError: function(e, t) {
            var a = t || "失败",
                o = document.createElement("div");
            o.setAttribute("role", "alert"), o.setAttribute("aria-live", "assertive"), o.setAttribute("aria-atomic", "true");
            var n = "toast" + (new Date).getTime();
            o.className = "toast toast-error toast-custom " + n;
            var i = '        <div class="toast-header bg-danger text-white">\n            <strong class="mr-auto">' + a + "</strong>\n" + "            <small></small>\n" + '            <button type="button" class="ml-2 mb-1 close text-white" data-dismiss="toast" aria-label="Close">\n' + '                <span aria-hidden="true">&times;</span>\n' + "            </button>\n" + "        </div>\n" + '        <div class="toast-body toast-custom-error"><i class="iconfont">&#xe68b;</i>' + e + "</div>\n";
            o.innerHTML = i, $(".toast-area").append(o), $(o).toast({
                delay: this.timeOut
            }).toast("show")
        },
        bsWarning: function(e, t) {
            var a = t || "温馨提示",
                o = document.createElement("div");
            o.setAttribute("role", "alert"), o.setAttribute("aria-live", "assertive"), o.setAttribute("aria-atomic", "true");
            var n = "toast" + (new Date).getTime();
            o.className = "toast toast-warning toast-custom " + n;
            var i = '        <div class="toast-header bg-warning text-white">\n            <strong class="mr-auto">' + a + "</strong>\n" + "            <small></small>\n" + '            <button type="button" class="ml-2 mb-1 close text-white" data-dismiss="toast" aria-label="Close">\n' + '                <span aria-hidden="true">&times;</span>\n' + "            </button>\n" + "        </div>\n" + '        <div class="toast-body toast-custom-warning"><i class="iconfont">&#xe607;</i>' + e + "</div>\n";
            o.innerHTML = i, $(".toast-area").append(o), $(o).toast({
                delay: this.timeOut
            }).toast("show")
        }
    },
    dialogAlert = {
        confirm: function(e, t, a, o, n) {
            var i = e || "温馨提示",
                s = t || "您确定执行此操作吗？",
                r = document.createElement("button");
            r.className = "btn btn-primary", r.innerText = "确定";
            var d = document.createElement("button");
            d.className = "btn btn-light", d.setAttribute("data-dismiss", "modal"), d.innerText = "取消", a && (r.innerText = a[0] || "确定", d.innerText = a[1] || "取消");
            var l = document.createElement("div");
            o && $(r).click(function() {
                o(l, r, d)
            }), n && $(d).click(function() {
                n(l, r, d)
            }), l.className = "modal fade dialog-confirm", l.id = "dialogConfrim" + (new Date).getTime(), l.setAttribute("tabindex", "-1"), l.setAttribute("role", "dialog"), l.setAttribute("aria-labelledby", "dialogConfrimlLabel"), l.setAttribute("aria-hidden", "true"), l.setAttribute("data-backdrop", "static"), l.setAttribute("data-keyboard", "false"), l.innerHTML = '<div class="modal-dialog modal-dialog-scrollable modal-dialog-centered">\n        <div class="modal-content">\n            <div class="modal-header">\n                <h5 class="modal-title text-ellipsis">' + i + "</h5>\n" + "            </div>\n" + '            <div class="modal-body">\n' + s + "            </div>\n" + '    <div class="modal-footer">\n' + "    </div>\n" + "        </div>\n" + "    </div>\n", $("body").append(l), $(l).find(".modal-footer").append(d).append(r), $(l).modal("show"), $(l).on("hidden.bs.modal", function() {
                $(l).modal("dispose"), $(l).remove()
            })
        },
        alert: function(e, t, a, o, n) {
            var i = "dialog-alert-default";
            o && (i = "dialog-alert-" + o);
            var s = e || "温馨提示",
                r = t || "点击确定关闭弹窗",
                d = document.createElement("button");
            d.className = "btn btn-primary", d.innerText = "确定", d.setAttribute("data-dismiss", "modal"), a && (d.innerText = a || "确定");
            var l = document.createElement("div");
            n && $(d).click(function() {
                n(l, d)
            }), l.className = "modal fade dialog-alert " + i, l.id = "dialogAlert" + (new Date).getTime(), l.setAttribute("tabindex", "-1"), l.setAttribute("role", "dialog"), l.setAttribute("aria-labelledby", "dialogAlertlLabel"), l.setAttribute("aria-hidden", "true"), l.setAttribute("data-backdrop", "static"), l.setAttribute("data-keyboard", "false"), l.innerHTML = '<div class="modal-dialog modal-dialog-scrollable modal-dialog-centered">\n        <div class="modal-content">\n            <div class="modal-header">\n                <h5 class="modal-title text-ellipsis">' + s + "</h5>\n" + "            </div>\n" + '            <div class="modal-body">\n' + r + "            </div>\n" + '    <div class="modal-footer">\n' + "    </div>\n" + "        </div>\n" + "    </div>\n", $("body").append(l), $(l).find(".modal-footer").append(d), $(l).modal("show"), $(l).on("hidden.bs.modal", function() {
                $(l).modal("dispose"), $(l).remove()
            })
        }
    };
$("body").on("hidden.bs.toast", ".toast", function() {
    $(this).remove()
});
var accessToken = "",
    Login = function(e, t, a, o, n, i, s) {
        function r(a) {
            var i = validateFields(d.initRules);
            if (i) {
                if (s && !s()) return;
                var r = $(a).text();
                $(a).btnLoading("请求中，请稍候...");
                var l = a,
                    c = document.getElementById(t),
                    m = new FormData(c);
                $.ajax({
                    type: "POST",
                    url: o,
                    data: m,
                    dataType: "json",
                    timeout: 3e4,
                    processData: !1,
                    contentType: !1,
                    success: function(t) {
                        400 === t.code ? (messageAlert.bsError(t.msg), $(l).btnReset(r)) : 200 === t.code && "login" === e && (messageAlert.bsSuccess(t.msg), clearInterval(wxLoginStatusInterval), isOpenModalFirst = !0, $(l).btnReset(r), loginCookie(t), loginHideShow.login()), n && (n(t), $(l).btnReset(r))
                    },
                    error: function() {
                        refreshPicVericode(".picVericodeUrl"), messageAlert.bsError("请求失败，请稍候重试"), $(l).btnReset(r)
                    }
                })
            }
        }
        this.initRules = a || [{
            prop: "account",
            required: !0,
            message: "请输入账号"
        }, {
            prop: "password",
            required: !0,
            message: "请输入密码"
        }, {
            prop: "vericode",
            required: !0,
            message: "请输入验证码"
        }];
        var d = this;
        validateFields(this.initRules, !0, !0), $("body").on("click", "#" + t + " .submit", function() {
            r(this)
        }), $(d.initRules).each(function(e, a) {
            var o = a.enter;
            o && $("body").on("keyup", "#" + a.prop, function(e) {
                ("13" === e.keyCode || 13 === e.keyCode) && r("#" + t + " .submit")
            })
        })
    },
    validateFields = function(e, t, a) {
        var o = e || [],
            n = !0,
            i = t || !1,
            s = a || !1;
        return $(o).each(function(e, t) {
            var a = "#" + t.prop,
                o = $(a).val(),
                r = t.required,
                d = t.message,
                l = t.className || "",
                c = t.regx || "",
                m = t.trigger || "blur";
            if (r && (s && $("body").on(m, a, function() {
                var e = $(a).val();
                !e || c && -1 === e.search(c) ? ($(a).parent().find("div").eq(0).text(d || "请完善此信息"), $(a).removeClass(l)) : ($(a).parent().find("div").eq(0).text(""), $(a).addClass(l))
            }), !i)) {
                var p = $(a).val();
                !p || c && -1 === p.search(c) ? ($(a).parent().find("div").eq(0).text(d || "请完善此信息"), $(a).removeClass(l)) : ($(a).parent().find("div").eq(0).text(""), $(a).addClass(l))
            }!o && r ? n = !1 : c && -1 === o.search(c) && (n = !1)
        }), n
    },
    getPhoneVericode = {
        interval: !1,
        time: 60,
        ajaxUrl: "/member_login/get_sms_code",
        id: "#getPhoneVericode",
        phoneId: "#loginPhone",
        mobile: "",
        rules: [{
            prop: "loginPhone",
            required: !0,
            message: "请输入正确的手机号",
            regx: "^1[3456789]\\d{9}$",
            className: "success"
        }, {
            prop: "picVericode1",
            required: !0,
            message: "请输入验证码",
            className: "success"
        }],
        getVericode: function() {
            if (!this.interval) {
                var e = $(this.phoneId).val(),
                    t = $(this.phoneId).parents("form").find(".pic-vericode input").eq(0).val(),
                    a = $(this.phoneId).parents("form").find(".hiddenKey").eq(0).val(),
                    o = validateFields(this.rules);
                if (o) {
                    this.mobile = e;
                    var n = {
                        mobile: e,
                        code: t,
                        key: a
                    };
                    this.disabledBtn();
                    var i = this;
                    this.ajax(n, function() {
                        clearInterval(this.interval);
                        var e = i.time;
                        $(i.id).text(e), i.interval = setInterval(function() {
                            e--, 0 === e ? (clearInterval(i.interval), i.interval = !1, $(i.id).text("重新获取"), i.refreshBtn()) : $(i.id).text(e)
                        }, 1e3)
                    })
                } else this.phoneNumber = ""
            }
        },
        disabledBtn: function() {
            $(this.id).attr("disabled", !0)
        },
        refreshBtn: function() {
            $(this.id).attr("disabled", !1)
        },
        ajax: function(e, t) {
            var a = this;
            $.ajax({
                type: "POST",
                url: this.ajaxUrl,
                data: e,
                dataType: "json",
                timeout: 3e4,
                success: function(e) {
                    400 === e.code ? (messageAlert.bsError(e.msg), a.refreshBtn(), refreshPicVericode(".picVericodeUrl")) : 200 === e.code && (messageAlert.bsSuccess("短信验证码发送成功，请及时接收"), t())
                },
                error: function() {
                    a.refreshBtn(), refreshPicVericode(".picVericodeUrl")
                }
            })
        }
    },
    loginHideShow = {
        login: function() {
            $(".login-show").show(), $(".login-hide").hide();
            var e = $.cookie("yuanwenku-login-avatar"),
                t = $.cookie("yuanwenku-login-username"),
                a = $.cookie("yuanwenku-login-vip");
            e && $(".user-avatar").prop("src", e), t && $(".user-name").text(t), "1" === a ? ($(".user-vip").show(), $(".user-vip").addClass("text-warning"), $(".vip-show").show(), $(".vip-hide").hide()) : ($(".vip-hide").show(), $(".vip-show").hide(), $(".user-vip").removeClass("text-warning")), $("body").off("click", ".goToNeedloginpage"), $("body").on("click", ".goToNeedloginpage", function() {
                var e = $(this).attr("data-blank"),
                    t = $(this).attr("data-href");
                "blank" === e ? window.open(t) : window.location.href = t
            }), "/member/login.html" === window.location.pathname && (window.location.href = "/user/pc/index.html"), document.getElementById("needAccessToken") && getAccessToken()
        },
        unLogin: function() {
            $(".login-show").hide(), $(".login-hide").show(), $(".user-vip").removeClass("text-warning"), $(".user-avatar").prop("src", "/static/images/head portrait-01.png"), $("body").off("click", ".goToNeedloginpage"), $("body").on("click", ".goToNeedloginpage", function() {
                var e = $(this).attr("data-blank");
                "blank" === e ? window.open("/member/login.hrml") : window.location.href = "/member/login.hrml"
            }), accessToken = ""
        }
    },
    rememberAccount = {
        remember: function(e, t) {
            var a = $("#" + e).prop("checked");
            a ? $.cookie("#" + e, t, {
                domain: host
            }) : $.removeCookie("#" + e, {
                domain: host
            })
        }
    },
    loadingRecharge = {
        container: ".recharge-member-list",
        btn: ".recharge-member-list li button",
        wxid: "payWechat",
        aliid: "payAli",
        payMoneyId: "#payMoney",
        typeAjax: "/recharge/member_plan_list",
        qrcodeAjax: "/recharge/member_recharge",
        orderType: 3,
        tragetId: 0,
        orderNo: "",
        checkPayStatusInterval: "",
        templateFun: function(e) {
            var t = this;
            $(e).each(function(e, a) {
                var o = "";
                0 === e && (o = "selected", t.getQrcode(a.id, a.money));
                var n = '<li class="col-3">\n<button type="button" class="d-flex align-items-center btn-light ' + o + '" disabled  data-id="' + a.id + '"  data-money="' + a.price + '">\n' + '                        <div class="title-box">' + a.group_name + "</div>\n" + '                        <div class="flex-grow-1 px-4">\n' + '                            <p class="text-danger"><span>￥</span>' + a.price + " / 月</p>\n" + "                            <p>" + a.vip_ad + "</p>\n" + "                        </div>\n" + '                        <i class="iconfont">&#xe7df;</i>\n' + "                    </button>\n" + "                </li>";
                $(".recharge-member-list").append(n)
            })
        },
        init: function() {
            $(this.container).boxBsLoading();
            var e = this;
            $("body").on("click", this.btn, function(t) {
                t.stopPropagation(), $(e.btn).removeClass("selected").attr("disabled", !0), $(this).addClass("selected");
                var a = $(this).attr("data-id"),
                    o = $(this).attr("data-money");
                e.getQrcode(a, o)
            }), $.ajax({
                type: "POST",
                url: this.typeAjax,
                data: {},
                dataType: "json",
                timeout: 3e4,
                success: function(t) {
                    200 === t.code ? (arr = t.data, e.templateFun(arr)) : messageAlert.bsError(t.msg), $(e.container).boxBsLoadingReset()
                },
                error: function() {
                    messageAlert.bsError("网络错误，请稍后重试"), $(e.container).boxBsLoadingReset()
                }
            })
        },
        getQrcode: function(e) {
            $("#" + this.wxid).html("").boxBsLoading(), $("#" + this.aliid).html("").boxBsLoading(), $(this.payMoneyId).html("");
            var t = this;
            $.ajax({
                type: "POST",
                url: this.qrcodeAjax,
                data: {
                    terminal: "PC",
                    recharge_id: e,
                    order_type: this.orderType,
                    target_id: this.tragetId
                },
                dataType: "json",
                timeout: 3e4,
                success: function(e) {
                    200 === e.code ? (t.createQrcode(e.data.url_wechat, t.wxid), createAliQrcode(e.data.url_alipay, t.aliid, 118), $(t.payMoneyId).html(e.data.price), t.orderNo = e.data.order_no, clearInterval(t.checkPayStatusInterval), t.checkPayStatusInterval = setInterval(function() {
                        t.checkPayStatus()
                    }, 4e3)) : messageAlert.bsError(e.msg), $(t.btn).attr("disabled", !1)
                },
                error: function() {
                    messageAlert.bsError("网络错误，请稍后重试"), $(t.btn).attr("disabled", !1)
                }
            })
        },
        createQrcode: function(e, t) {
            $("#" + t).html(""), new QRCode(t, {
                text: e,
                width: 118,
                height: 118,
                colorDark: "#000000",
                colorLight: "#ffffff",
                correctLevel: QRCode.CorrectLevel.H,
                render: "canvas"
            })
        },
        checkPayStatus: function() {
            var e = this;

        }
    },
    rules = [{
        prop: "loginPhone",
        required: !0,
        message: "请输入正确的手机号",
        regx: "^1[3456789]\\d{9}$",
        className: "success"
    }, {
        prop: "picVericode1",
        required: !0,
        message: "请输入验证码",
        className: "success"
    }, {
        prop: "loginVericode",
        required: !0,
        message: "请输入验证码",
        className: "success",
        enter: !0
    }],
    rules2 = [{
        prop: "loginPhone2",
        required: !0,
        message: "请输入正确的手机号",
        regx: "^1[3456789]\\d{9}$",
        className: "success"
    }, {
        prop: "loginPassword",
        required: !0,
        message: "请输入英文和数字的混合密码，长度不小于6位",
        regx: "^(?![^a-zA-Z]+$)(?!\\D+$)[a-zA-Z0-9]{6,}$",
        className: "success"
    }, {
        prop: "picVericode",
        required: !0,
        message: "请输入验证码",
        className: "success",
        enter: !0
    }],
    rules3 = [{
        prop: "loginPhone3",
        required: !0,
        message: "请输入正确的手机号",
        regx: "^1[3456789]\\d{9}$",
        className: "success"
    }, {
        prop: "picVericode3",
        required: !0,
        message: "请输入验证码",
        className: "success"
    }, {
        prop: "loginVericode3",
        required: !0,
        message: "请输入验证码",
        className: "success",
        enter: !0
    }],
    rules31 = [{
        prop: "loginPassword31",
        required: !0,
        message: "请输入英文和数字的混合密码，长度不小于6位",
        regx: "^(?![^a-zA-Z]+$)(?!\\D+$)[a-zA-Z0-9]{6,}$",
        className: "success"
    }, {
        prop: "loginPassword32",
        required: !0,
        message: "请输入英文和数字的混合密码，长度不小于6位",
        regx: "^(?![^a-zA-Z]+$)(?!\\D+$)[a-zA-Z0-9]{6,}$",
        className: "success"
    }, {
        prop: "picVericode31",
        required: !0,
        message: "请输入验证码",
        className: "success",
        enter: !0
    }],
    rules4 = [{
        prop: "loginPhone4",
        required: !0,
        message: "请输入正确的手机号",
        regx: "^1[3456789]\\d{9}$",
        className: "success"
    }, {
        prop: "loginPassword4",
        required: !0,
        message: "请输入英文和数字的混合密码，长度不小于6位",
        regx: "^(?![^a-zA-Z]+$)(?!\\D+$)[a-zA-Z0-9]{6,}$",
        className: "success"
    }, {
        prop: "picVericode4",
        required: !0,
        message: "请输入验证码",
        className: "success"
    }, {
        prop: "loginVericode4",
        required: !0,
        message: "请输入验证码",
        className: "success",
        enter: !0
    }],
    rules5 = [{
        prop: "reportReason",
        required: !0,
        message: "请选择举报原因",
        className: "success",
        trigger: "change"
    }, {
        prop: "reportContract",
        required: !0,
        regx: "^1[3456789]\\d{9}$",
        message: "请输正确的手机号",
        className: "success"
    }, {
        prop: "reportDetail",
        required: !0,
        message: "请输入详细说明",
        className: "success"
    }],
    rules6 = [{
        prop: "feedbackDetail",
        required: !0,
        message: "请输入意见反馈",
        className: "success"
    }, {
        prop: "feedbackContract",
        required: !0,
        message: "请输入正确的手机号",
        regx: "^1[3456789]\\d{9}$",
        className: "success"
    }, {
        prop: "feedbackImage",
        required: !1,
        message: "请上传图片",
        className: "success"
    }],
    rules71 = [{
        prop: "loginOldAccount",
        required: !0,
        message: "请输入账号",
        className: "success"
    }, {
        prop: "loginOldPassword",
        required: !0,
        message: "请输入英文和数字的混合密码，长度不小于6位",
        regx: "^(?![^a-zA-Z]+$)(?!\\D+$)[a-zA-Z0-9]{6,}$",
        className: "success"
    }],
    rules72 = [{
        prop: "loginPhone52",
        required: !0,
        message: "请输入正确的手机号",
        regx: "^1[3456789]\\d{9}$",
        className: "success"
    }, {
        prop: "picVericode52",
        required: !0,
        message: "请输入验证码",
        className: "success"
    }, {
        prop: "loginVericode52",
        required: !0,
        message: "请输入验证码",
        className: "success",
        enter: !0
    }],
    newLogin = new Login("login", "loginForm", rules, "/member_login/phone_code_login", function(e) {
        refreshPicVericode(".picVericodeUrl"), 200 === e.code && $("#closeLoginModal").click()
    }, function() {
        refreshPicVericode(".picVericodeUrl")
    }),
    newLogin2 = new Login("login", "loginForm2", rules2, "/member_login/phone_login", function(e) {
        refreshPicVericode(".picVericodeUrl"), 200 === e.code && $("#closeLoginModal").click()
    }, function() {
        refreshPicVericode(".picVericodeUrl")
    }),
    newLogin3 = new Login("", "loginForm3", rules3, "/member_login/verify_forget_password", function(e) {
        200 === e.code && ($("#loginPhoneAgain").val($("#loginPhone3").val()), $("#modalMobileLogin").show(), $("#modalFreeReg").hide(), $("#modalQrcodeLogin").hide(), $("#modalMobileNumberLogin").hide(), $("#modalForgetPassword").hide(), $("#modalForgetPasswordNext").show(), $("#modalMobilePasswordLogin").hide()), refreshPicVericode(".picVericodeUrl")
    }, function() {
        messageAlert.bsError("修改失败", "失败"), refreshPicVericode(".picVericodeUrl")
    }),
    newLogin31 = new Login("", "loginForm31", rules31, "/user/change_password", function(e) {
        200 === e.code && (messageAlert.bsSuccess(e.msg, "成功"), $("#modalMobileLogin").show(), $("#modalFreeReg").hide(), $("#modalQrcodeLogin").hide(), $("#modalMobileNumberLogin").hide(), $("#modalForgetPassword").hide(), $("#modalForgetPasswordNext").hide(), $("#modalMobilePasswordLogin").show())
    }, function() {
        messageAlert.bsError("修改失败", "失败"), refreshPicVericode(".picVericodeUrl")
    }, function() {
        return $("#loginPassword31").val() !== $("#loginPassword32").val() ? (messageAlert.bsError("两次输入密码不一致"), !1) : !0
    }),
    newLogin71 = new Login("", "loginForm51", rules71, "/member_login/username_login", function(e) {
        200 === e.code && ($("#modalOldLoginFirst").hide(), $("#modalOldLoginSecond").show(), $("#oldLoginUserName").val($("#loginOldAccount").val()))
    }),
    newLogin72 = new Login("", "loginForm52", rules72, "/member_login/old_user_bind_mobile", function(e) {
        200 === e.code && (messageAlert.bsSuccess(e.msg), clearInterval(wxLoginStatusInterval), isOpenModalFirst = !0, loginCookie(e), loginHideShow.login())
    }),
    newLogin4 = new Login("login", "loginForm4", rules4, "/user/register", function(e) {
        refreshPicVericode(".picVericodeUrl"), 200 === e.code && $("#closeLoginModal").click()
    }, function() {
        refreshPicVericode(".picVericodeUrl")
    }, function() {
        var e = $("#regAgree").prop("checked");
        return e ? !0 : (messageAlert.bsError("请阅读并同意《用户注册协议》"), !1)
    }),
    newLogin5 = new Login("", "reportForm", rules5, "/content/ajax_feedback", function(e) {
        200 === e.code && ($("#closeReportModal").click(), messageAlert.bsSuccess(e.msg))
    }, function() {}),
    newLogin6 = new Login("", "feedbackForm", rules6, "/service_center/post_feedback", function(e) {
        200 === e.code ? (messageAlert.bsSuccess(e.msg), $("#feedbackReset").click()) : messageAlert.bsError(e.msg)
    }, null, function() {
        var e = [],
            t = !0;
        return $.cookie("yuanwenku-login-status") && "1" === $.cookie("yuanwenku-login-status") ? $("#feedbackDetail").val().length < 10 ? (t = !1, messageAlert.bsError("您的意见不足10个字，再多写点吧！"), t) : ($(".file-preview .kv-preview-thumb>.kv-file-content .file-preview-image").each(function(a, o) {
            return "true" !== $(o).attr("data-uploaded") ? (t = !1, messageAlert.bsError("您还有图片需要上传，请先上传图片再提交反馈。"), !1) : (e.push($(o).attr("src")), void 0)
        }), $("#feedbackImgList").val(e.join(",")), t) : ($("#loginModal").modal("show"), !1)
    });
$("body").on("click", '*[data-type="tab"]', function(e) {
    e.stopPropagation();
    var t = $(this).attr("data-target"),
        a = $(this).attr("data-active") || "yes",
        o = $(this).attr("data-class") || "active",
        n = $(this).parent().find('*[data-type="tab"]');
    n.each(function(e, t) {
        var n = $(t).attr("data-target");
        "yes" === a && $(t).removeClass(o), $(n).hide()
    }), $(t).show(), "yes" === a && $(this).addClass(o)
}), $("body").on("click", "#getPhoneVericode", function() {
    getPhoneVericode.getVericode()
});
var getPhoneVericodeOption = createNewObject(getPhoneVericode);
getPhoneVericodeOption.id = "#getPhoneVericode3", getPhoneVericodeOption.interval = !1, getPhoneVericodeOption.phoneId = "#loginPhone3", getPhoneVericodeOption.rules = [{
    prop: "loginPhone3",
    required: !0,
    message: "请输入正确的手机号",
    regx: "^1[3456789]\\d{9}$",
    className: "success"
}, {
    prop: "picVericode3",
    required: !0,
    message: "请输入验证码",
    className: "success"
}], $("body").on("click", "#getPhoneVericode3", function() {
    getPhoneVericodeOption.getVericode()
});
var getPhoneVericodeOption2 = createNewObject(getPhoneVericode);
getPhoneVericodeOption2.id = "#getPhoneVericode4", getPhoneVericodeOption2.interval = !1, getPhoneVericodeOption2.phoneId = "#loginPhone4", getPhoneVericodeOption2.rules = [{
    prop: "loginPhone4",
    required: !0,
    message: "请输入正确的手机号",
    regx: "^1[3456789]\\d{9}$",
    className: "success"
}, {
    prop: "picVericode4",
    required: !0,
    message: "请输入验证码",
    className: "success"
}], $("body").on("click", "#getPhoneVericode4", function() {
    getPhoneVericodeOption2.getVericode()
});
var getPhoneVericodeOption3 = createNewObject(getPhoneVericode);
getPhoneVericodeOption3.id = "#getPhoneVericode52", getPhoneVericodeOption3.interval = !1, getPhoneVericodeOption3.phoneId = "#loginPhone52", getPhoneVericodeOption3.rules = [{
    prop: "loginPhone52",
    required: !0,
    message: "请输入正确的手机号",
    regx: "^1[3456789]\\d{9}$",
    className: "success"
}, {
    prop: "picVericode52",
    required: !0,
    message: "请输入验证码",
    className: "success"
}], $("body").on("click", "#getPhoneVericode52", function() {
    getPhoneVericodeOption3.getVericode()
});


$(".login-modal").click(function() {
 //   $("#modalMobileLogin").hide(), $("#modalFreeReg").hide(), $("#modalQrcodeLogin").show(), $("#modalMobileNumberLogin").show(), $("#modalForgetPassword").hide(), $("#modalForgetPasswordNext").hide(), $("#modalMobilePasswordLogin").hide()
});


$(".reg-modal").click(function() {
    $("#modalMobileLogin").show(), $("#modalFreeReg").show(), $("#modalQrcodeLogin").hide(), $("#modalMobileNumberLogin").hide(), $("#modalForgetPassword").hide(), $("#modalForgetPasswordNext").hide(), $("#modalMobilePasswordLogin").hide()
});

$("#loginModal").on("shown.bs.modal", function() {
    isOpenModalFirst ? (isOpenModalFirst = !1, refreshPicVericode(".picVericodeUrl")) : (clearInterval(wxLoginStatusInterval), wxLoginStatusInterval = setInterval(function() {
        requestLoginStatus(wxSceneStr)
    }, 3e3))
});

$("#loginModal").on("hidden.bs.modal", function() {
    clearInterval(wxLoginStatusInterval)
});

$("body").on("click", ".picVericodeBtn", function() {
    refreshPicVericode(".picVericodeUrl")
});


var loginStatus = $.cookie("yuanwenku-login-status");
loginStatus && "1" === loginStatus && loginHideShow.login(), $("#logOut").click(function() {
    var e = $(this).attr("data-linkto");
    loginOut(e)
}), $("#loginPhone").val($.cookie("#loginPhone")), $("#loginPhone2").val($.cookie("#loginPhone2")), $("#loginPassword").val($.cookie("#loginPassword")), $(".fixed-commond,.fixed-nav").toast({
    autohide: !1
}), $(".fixed-commond,.fixed-nav").toast("show");
var goTop = new fixedNavAndTop;
goTop.goTop(), $(".empty-box").each(function(e, t) {
    var a = $(t).attr("data-emptytxt");
    a = a ? "<p>" + a + "</p>" : "", $(t).append('<div class="empty-box-i"><i class="iconfont">&#xe621;</i>' + a + "</div>")
}), $(".empty-box-2").each(function(e, t) {
    var a = $(t).attr("data-emptytxt");
    a = a ? "<p>" + a + "</p>" : "", $(t).append('<div class="empty-box-img"><img src="/static/images/empty.png">' + a + "</div>")
}), $("#navSidebarTabContent li").hover(function() {
    $(this).find(".nav-popover").show()
}, function() {
    $(this).find(".nav-popover").hide()
}), $(document).ready(function() {
    var e, t, a = 0,
        o = "",
        n = !0,
        i = [];
    $("body").on("click", ".view-modal", function() {
        clearTimeout(e);
        try {
            t.abort()
        } catch (s) {}
        $("#viewModal .modal-title").text($(this).attr("data-title")), o = $(this).attr("data-id"), a = 0, n = !0, $("#viewImgBox").html(""), $("#viewModal").modal("show"), $("html").addClass("overflow-hidden height-100"), $("#viewModal .article-viewall").prop("href", $(this).attr("data-href")), $("#viewModal .article-download").attr({
            "data-id": $(this).attr("data-id"),
            "data-price": $(this).attr("data-price"),
            "data-size": $(this).attr("data-size") + "kb",
            "data-type": $(this).attr("data-type"),
            "data-page": $(this).attr("data-page"),
            "data-vip": $(this).attr("data-vip"),
            "data-binddown": $(this).attr("data-bind"),
            "data-title": $(this).attr("data-title")
        });
        var r = $("#viewModal .article-collection").html(),
            d = $(this).attr("data-id");
        $("#viewModal .article-collection").iconLoading(), $.cookie("yuanwenku-login-status") && "1" === $.cookie("yuanwenku-login-status") ? t = $.ajax({
            type: "POST",
            url: "/favorite/is_favorite_content",
            data: {
                content_id: d
            },
            dataType: "json",
            timeout: 3e4,
            success: function(e) {
                200 === e.code && (e.data ? $(".article-collection").attr("data-collection", "true") : $(".article-collection").attr("data-collection", "false")), $("#viewModal .article-collection").iconReset(r)
            },
            error: function() {}
        }) : ($(".article-collection").attr("data-collection", "false"), $("#viewModal .article-collection").iconReset(r)), $(".article-collection").attr("data-id", $(this).attr("data-id")), $("#viewModal .modal-body").boxBsLoading(), loadingViewData("#viewModal .modal-body", "/content/fetch_preview", {
            page: a,
            id: o
        }, function(e) {
            if (200 === e.code)
                if (e.data.length > 0) {
                    if ($(e.data).each(function(e, t) {
                        if (e > 2) return !1;
                        var a = '<img src="' + t + '">';
                        $("#viewImgBox").append(a)
                    }), e.data.length < 3 || 3 === e.data.length) return;
                    var t = e.data[2].split("/"),
                        a = parseInt(t[t.length - 1].split(".")[0]),
                        o = "." + t[t.length - 1].split(".")[1],
                        n = e.data.length - 3;
                    $("#dataLoading").html('还剩&nbsp;<b class="font-weight-normal">' + n + '</b>&nbsp;页未读，<span class="text-primary">点击继续阅读</span><i class="iconfont text-primary">&#xecfe;</i>'), $("#dataLoading").show(), $("#dataLoading").prop("disabled", !1), n = n ? parseInt(n) : 0, t.pop();
                    var s = t.join("/");
                    i = [];
                    for (var r = 0; n > r; r++) {
                        var d = s + "/" + (a + r + 1) + o;
                        i.push(d)
                    }
                } else $("#viewModal .modal-body").attr("data-empty", "true");
            else messageAlert.bsError(e.msg), $("#viewModal .modal-body").attr("data-empty", "true")
        }, function() {})
    }), $("body").on("click", "#dataLoading", function() {
        if (n && i.length) {
            a++;
            var e = 5 * (a - 1) - 1,
                t = 5 * a;
            $(i).each(function(a, o) {
                if (a > e && t > a) {
                    var n = document.createElement("img");
                    n.src = o, $("#viewImgBox").append(n)
                } else if (a >= t) return !1
            }), i.length <= t ? (n = !1, $("#dataLoading").html('<span class="text-primary">预览已结束，查看全部内容需要购买此文档</span>'), $("#dataLoading").prop("disabled", !0)) : $("#dataLoading").html('还剩&nbsp;<b class="font-weight-normal">' + (i.length - t) + '</b>&nbsp;页未读，<span class="text-primary">点击继续阅读</span><i class="iconfont text-primary">&#xecfe;</i>')
        }
    }), $("#viewModal").on("hidden.bs.modal", function() {
        viewModalAjax.abort(), $("#dataLoading").hide(), $("html").removeClass("overflow-hidden height-100"), $("#viewModal .modal-body").attr("data-empty", "false"), $("#viewModal .modal-body #viewImgBox").html("")
    }), $("body").on("click", ".article-collection", function() {
        if ($.cookie("ywk-login-status") && "1" === $.cookie("ywk-login-status")) {
            var e = "false" === $(this).attr("data-collection") ? "/favorite/add_to_favorite_contents" : "/favorite/remove_from_favorite_contents",
                t = "false" === $(this).attr("data-collection") ? 1 : 0;
            collectionArticle(this, {
                content_id: $(this).attr("data-id"),
                status: t
            }, e)
        } else $(this).attr("data-close") && $($(this).attr("data-close")).modal("hide"), $("#loginModal").modal("show")
    }), $("body").on("click", ".topic-collection", function() {
        if ($.cookie("ywk-login-status") && "1" === $.cookie("ywk-login-status")) {
            var e = "false" === $(this).attr("data-collection") ? "/favorite/add_to_favorite_topics" : "/favorite/remove_from_favorite_topics",
                t = "false" === $(this).attr("data-collection") ? 1 : 0;
            collectionArticle(this, {
                topic_id: $(this).attr("data-id"),
                status: t
            }, e)
        } else $(this).attr("data-close") && $($(this).attr("data-close")).modal("hide"), $("#loginModal").modal("show")
    }), $("body").on("click", ".article-state", function() {
        if ($.cookie("ywk-login-status") && "1" === $.cookie("ywk-login-status")) {
            var e = "href=" + window.location.href + "&",
                t = "title=" + $(this).attr("data-title") + "&",
                a = "id=" + $(this).attr("data-id") + "&",
                o = "code=" + $(this).attr("data-cid");
            window.open("/user/pc/index.html#/copyrightAppeal/index?" + e + t + a + o)
        } else $(this).attr("data-close") && $($(this).attr("data-close")).modal("hide"), $("#loginModal").modal("show")
    })
});



// $("body").on("click", '[data-btn="downloadlq"]', function() {
$("body").on("click", '[data-btn="downloadlq"]', function() {
    var e = $(this).attr("data-binddown"),
        t = $(this),
        a = $(this).attr("data-id"),
        o = $(this).attr("data-ztid"),
        n = $(this).attr("data-all"),
        i = $(this).attr("data-price"),
        s = $(this).attr("data-title"),
        r = $(this).attr("data-size"),
        d = $(this).attr("data-page"),
        l = $(this).attr("data-topic"),
        c = $(this).attr("data-body"),
        m = $(this).attr("data-isold");

});

searchBtn();
initHistory();

// document.addEventListener("contextmenu", function(e) {
//     e.preventDefault()
// });